<script type="text/javascript">
  function esitle()
    {
        document.getElementById("txt2").value=document.getElementById("txt1").value;
    }
  function gonder()
    {
        var str="gönderiliyor";
        alert(str);
    }
  function sil()
  {
      return confirm("emin misin?")
  }
  function odaklan(x)
  {
      document.getElementById(x).style.backgroundColor="yellow";
  }
  function terk(x)
  {
      document.getElementById(x).style.backgroundColor="white";
  }
        function key_event()
        {
            var a=event.keyCode;
            var b=String.fromCharCode(a);
            document.getElementById("yaz").innerHTML=b;
        }
</script>
<%= form_for(@article) do |f| %>
  <% if @article.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>

      <ul>
      <% @article.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :title %><br />
    <%= f.text_field(:title, :id => "txt1", :onfocus => "odaklan(this.id)", :onblur => "terk(this.id)")%>
  </div>
  <div class="field">
    <%= f.label :body %><br />
    <%= f.text_area(:body, :id => "txt2", :onfocus => "odaklan(this.id)", :onblur => "terk(this.id)", :onkeydown => "key_event()")%>
  </div>
  <div class="actions">
    <%= f.submit(:type => "button", :value => "doldur", :onclick => "esitle()") %>
    <%= f.submit(:type => "reset", :value => "temizle", :onclick => "return sil()") %>
    <%= f.submit(:type => "submit", :value => "gonder", :onclick => "gonder()") %>
  </div>
  <div id="yaz" style="background-color: #ccc;"></div>
<% end %>
